-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support strictValidateTarballPkg #546
Conversation
elrrrrrrr
commented
Jul 8, 2023
•
edited
Loading
edited
- 🔨 Added the "strictValidateTarballPkg" mode to enable validation, only applicable to the slef registry scenario.
- 🧶 When the configuration is enabled, validate the relevant fields during publishing, currently only validating the fields affecting consumption.
- ♻️ No corrective actions will be taken for existing scenario data.
- 🔨 新增 strictValidateTarballPkg 配置,仅对在发布当前 registry 场景下生效
- 🧶 配置开启时,发布时校验相关字段,目前仅校验影响消费相关字段
- ♻️ 存量场景数据不做订正处理
Codecov Report
@@ Coverage Diff @@
## master #546 +/- ##
==========================================
- Coverage 97.02% 96.96% -0.06%
==========================================
Files 174 174
Lines 16588 16632 +44
Branches 2177 2181 +4
==========================================
+ Hits 16095 16128 +33
- Misses 493 504 +11
|
app/common/PackageUtil.ts
Outdated
onentry: entry => { | ||
let json = ''; | ||
entry.on('data', data => { | ||
json += data.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该不是走这种模式,data 是 buffer,走 buffer concat ,要不然有机会导致 json 最终拼接出来是错误的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry 是一个 stream?参考 https://github.com/node-modules/urllib/blob/master/test/utils.ts#L14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 await stream 的方式来拼接 Buffer,替换了原有方式。
由于在 onentry 才能拿到对应的 stream,还是使用了 Promise 来返回异步结果。